<script language="javascript" type="text/javascript">
  var displayTopColloc = function(data) {
    mydata = jQuery.parseJSON(data);
    $("#colloctopdiv").tagCloud(mydata);
  }

  var displayBottomColloc = function(data) {
    mydata = jQuery.parseJSON(data);
    $("#collocbottomdiv").tagCloud(mydata);
  }

  var displayChartColloc = function(data) {
    mydata = jQuery.parseJSON(data);
    plot = $.jqplot('collocchartdiv', mydata,
    { title:'N gram distribution',
      axes:{yaxis:{min:1, label:'log likelihood', renderer:$.jqplot.LogAxisRenderer},
        xaxis:{min:0, max: 50000, label:'id'}},
      series:[{color:'#5FAB78', label: 'histogram'}]
    });
  }

  var selectColloc = function(query) {
    $.get("${dataPath}/colloc/" + query + "/top.data", displayTopColloc);
    $.get("${dataPath}/colloc/" + query + "/bottom.data", displayBottomColloc);
    $.get("${dataPath}/colloc/" + query + "/chart.data", displayChartColloc);
  }
</script>